package com.lin.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lin.pojo.MDesignProcedure;
import com.lin.pojo.PageVo;
import com.lin.pojo.SysMenus;
import com.lin.service.MDesignProcedureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class MDesignProcedureController {
    @Autowired
    MDesignProcedureService mDesignProcedureService;

    @GetMapping("/queryalldesign.action")
    public PageVo<MDesignProcedure> queryallmde(MDesignProcedure mDesignProcedure,
                                                 @RequestParam(value = "pageno",defaultValue = "1") int pageno,
                                                 @RequestParam(value = "pagesize",defaultValue = "5") int pagesize){
        return mDesignProcedureService.queryallbycond(mDesignProcedure,pageno,pagesize);

    }

    @GetMapping("/modulecheck.action")
    public PageVo<MDesignProcedure> queryallmod(MDesignProcedure mDesignProcedure,
                                                @RequestParam(value = "pagenum",defaultValue = "1") int pageno,
                                                @RequestParam(value = "pagesize",defaultValue = "5") int pagesize){
        return mDesignProcedureService.queryallbycond(mDesignProcedure,pageno,pagesize);

    }

    @PutMapping("/tjdesign.action")
    public Map addMDesignProcedure(@RequestBody MDesignProcedure mDesignProcedure){

        System.out.println(mDesignProcedure);
        return mDesignProcedureService.addMDesignProcedure(mDesignProcedure);
    }

    @PutMapping("/updatedesign.action")
    public Map upMDesignProcedure(@RequestBody MDesignProcedure mDesignProcedure){
        return mDesignProcedureService.upMDesignProcedure(mDesignProcedure);
    }

    @RequestMapping("/querydesignbydid.action")
    public MDesignProcedure querydesignbydid(String id){

        QueryWrapper<MDesignProcedure> queryWrapper=new QueryWrapper<MDesignProcedure>();
        queryWrapper.eq("DESIGN_ID",id);

        return mDesignProcedureService.getOne(queryWrapper);
    }

    @PutMapping("/shdesign.action")
    public Map ckdesign(@RequestBody MDesignProcedure mDesignProcedure){

        return mDesignProcedureService.shdesign(mDesignProcedure);
    }
}
